unit IniciaFechamentoCupom;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Buttons, Mask;

type
  TFormIniciaFechamentoCupom = class(TForm)
    GBValor: TGroupBox;
    RB_DescontoValor: TRadioButton;
    RB_DescontoPercentual: TRadioButton;
    MaskEdit1: TMaskEdit;
    BitBtn1: TBitBtn;
    GBTIpo: TGroupBox;
    RB_Desconto: TRadioButton;
    RB_Acrescimo: TRadioButton;
    procedure BitBtn1Click(Sender: TObject);
    procedure RB_DescontoPercentualClick(Sender: TObject);
    procedure RB_DescontoValorClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FormIniciaFechamentoCupom: TFormIniciaFechamentoCupom;

implementation

uses principal;

{$R *.dfm}

procedure TFormIniciaFechamentoCupom.BitBtn1Click(Sender: TObject);
var valor:string;
begin
        valor:=MaskEdit1.Text; virgula:=pos(',',valor);
        Delete(valor, virgula, 1);
        FormPrincipal.DescontoItem:=valor;

        if Rb_DescontoValor.checked then FormPrincipal.TipoDescontoItem:='$'
        else FormPrincipal.TipoDescontoItem:='%';
        if Rb_Desconto.checked then FormPrincipal.TipoDescontoAcrescimo:='D'
        else FormPrincipal.TipoDescontoAcrescimo:='A';

        Close;

end;

procedure TFormIniciaFechamentoCupom.RB_DescontoPercentualClick(
  Sender: TObject);
begin
        MaskEdit1.MaxLength:=4;
        MaskEdit1.EditMask:='9999';
        MaskEdit1.Text:='1000';

end;

procedure TFormIniciaFechamentoCupom.RB_DescontoValorClick(
  Sender: TObject);
begin
        MaskEdit1.MaxLength:=9;
        MaskEdit1.EditMask:='999999999999,99';
        MaskEdit1.Text:='000000000001,00';
end;

end.
